package net.zjitc.annotation;

import java.lang.reflect.Method;

/**
 * Created by Administrator on 2017/11/6.
 */
public class Test {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        Class clazz = Class.forName("net.zjitc.annotation.MyAnnotation");
        Method[] methods = clazz.getMethods();
        //遍历方法
        for (Method m:methods) {
            //如果方法的注解是ResultMapping，获得注解对象
            ResultMapping annotation = m.getAnnotation(ResultMapping.class);
            //打印注解参数
            if(annotation!=null){
                String name = annotation.name();
                System.out.println(name);
            }
        }
    }
}
